<?php

/**
 * user actions.
 *
 * @package    LIAnnot
 * @subpackage user
 * @author     Cedric Richier
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class userActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
  	$this->publicAction = true;
    $this->forward('default', 'module');
  }
  
  public function executeRegister(sfWebRequest $request) {
 	 $this->form = new RegisterForm();
 	 $this->registration = true;
	  if ($request->isMethod('post'))
	  {
	    $this->form->bind($request->getParameter('sf_guard_user'));
	    $formValues = $this->form->getValues();
	    if ($this->form->isValid())
	    {
	    	$email = $formValues["email_adress"];
	    	$this->form->save();
		    $this->getUser()->signIn($this->form->getObject());
		    $this->getUser()->setFlash("Registration successful. You are now signin");
		    $this->redirect('@homepage');
	    }
	  }
  }
  
  public function executeCreateAccount(sfWebRequest $request) {
	  
  	return sfView::NONE;
  }
}
